package com.springboot.util;


import com.springboot.entity.OutParm;

/**
 * Restful API返回值工具类
 *
 * @author huihui
 */
public class OutParmUtil {

    public static final String SUCCESS = "0";
    public static final String FAIL = "-1";

    public static OutParm success(String msg, Object o) {
        OutParm result = new OutParm();
        result.setCode(SUCCESS);
        result.setResult(msg);
        result.setData(o);
        return result;
    }

    public static OutParm success(String msg, Object o,String url) {
        OutParm result = new OutParm();
        result.setCode(SUCCESS);
        result.setResult(msg);
        result.setData(o);
        result.setUrl(url);
        return result;
    }

    public static OutParm fail(String msg) {
        OutParm result = new OutParm();
        result.setCode(FAIL);
        result.setResult(msg);
        result.setData(null);
        return result;
    }
    public static OutParm fail(String msg, Object o) {
        OutParm result = new OutParm();
        result.setCode(FAIL);
        result.setResult(msg);
        result.setData(o);
        return result;
    }
}
